home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / INFO / DOSTIPS2.ZIP / DOSMISC.TXT < prev    next >
Text File  |  1985-11-24  |  32KB  |  723 lines

  1.                         Batch File Sorts
  2.         (PC Magazine Vol 3 No 8 May 1, 1984 User-to-User)
  3.  
  4.      In DOS 2.x it's easy to use batch files and filters to list your
  5. files alphabetically by filename, filename extension, or by the size of
  6. the file.  To do this, make sure your SORT.EXE file is on the disk you
  7. are sorting, and create a batch file called SDIR.BAT:
  8.  
  9. A>COPY CON:SDIR.BAT <Enter>
  10. DIR %1: |SORT /+%2>%3
  11.  
  12. Then hit the F6 key, and then the Enter key.  (The vertical bar
  13. character (|) before the word SORT is the DOS "piping" symbol.)
  14.      In this batch file, %1 designates the drive containing the 
  15. directory to be sorted, %2 stands for the column number of the 
  16. directory to be sorted, and %3 is the filename which it is to be 
  17. saved under.  Note that since there is a colon after %1, you won't 
  18. have to enter a colon when you tell SDIR.BAT which disk to sort.
  19.      To sort drive A alphabetically (using the first column), you 
  20. would type:
  21.           A>SDIR A 1 A:ASRT.DIR
  22. then hit the Enter key and you'll see on the screen:
  23.           A>DIR A:|SORT /+1>A:ASRT.DIR
  24.      For alphabetization of the FILENAME EXTENSION, type in 9 instead
  25. of 1.  Type:
  26.           A>SDIR A 9 A:FXSRT.DIR
  27. then hit the Enter key.
  28.      For the DIR to be listed by the size of the files, replace the 9
  29. with 13:
  30.           A>SDIR A 13 A:SZSRT.DIR
  31. and you'll get the same results as above but a different sorting of the
  32. directory.  You can also get a reverse order listing of the directory
  33. by typing /R after the column number:
  34.           A>SDIR A 13/R A:RSRT.DIR
  35. and hitting the Enter key.
  36.      Once you've created these sorted directory files, to use them just
  37. type the DOS TYPE command.  To view the initial alphabetical listing
  38. described above, for instance, type:
  39.           A>TYPE ASRT.DIR
  40. then hit the Enter key and you'll see all the files on your disk 
  41. rearranged alphabetically by filename.
  42.      It's probably best to have three batch files on your disk:
  43. SDIR.BAT to create sorted files, PSDIR.BAT to create them and print
  44. them out on your printer, and SSDIR.BAT to create them and print them
  45. on your screen.  For PSDIR.BAT type:
  46.           A>COPY CON:PSDIR.BAT <Enter>
  47.           DIR %1:|SORT/+%2>%3 <Enter>
  48.           COPY %3 LPT1: <F6><Enter>
  49. For SSDIR.BAT, type:
  50.           A>COPY CON:SSDIR.BAT <Enter>
  51.           DIR %1:|SORT /+%2>%3 <Enter>
  52.           COPY %3 CON: <F6><Enter>
  53.  
  54. -----------------------------------------------------------------
  55.                     Assembling a Port Switch
  56.       (PC Magazine Vol 3 No 18 Sept 18, 1984 User-to-User)
  57.  
  58.      The following .COM program written through DEBUG's Assemble 
  59. command in DOS 2.0 will run two printers for use with dBASE II.  The
  60. file is named PSWITCH.COM.
  61.  
  62. A>DEBUG
  63. -NPSWITCH.COM
  64. -A
  65. 1363:0100 MOV       AX,0040
  66. 1363:0103 MOV       DS,AX
  67. 1363:0105 MOV       SI,0008
  68. 1363:0108 MOV       AX,[SI]
  69. 1363:010A XCHG      [SI+02],AX
  70. 1363:010D MOV       [SI],AX
  71. 1363:010F MOV       AX,004C
  72. 1363:0112 INT       21
  73. 1363:0114
  74. -RCX
  75. 0000:     0014
  76. -W
  77. Writing 14 bytes
  78. -Q
  79. A>
  80.  
  81. -----------------------------------------------------------------
  82.                          Sloppy Floppies
  83.             (PC Magazine March 20, 1984 User-to-User)
  84.  
  85.      This procedure that will sort and keep track of files on floppy
  86. disks and let you locate any file in seconds.
  87.      You need DOS 2.x and a word processor, i.e., WordStar.  First 
  88. number all your disks on their labels.  DOS 2.x allows redirection of
  89. I/O, which will put the directories of each disk into individual files.
  90. To do this, get into DOS, put a blank, formatted disk into drive B:,
  91. put your disk #1 into drive A:, and at the DOS prompt A> type:
  92.           DIR>B:DISK1 <Enter>
  93. Then put disk #2 in, and type the same thing; disk #3, etc.  When 
  94. you're all done, you'll have a lot of directories on drive B: named
  95. DISK1, DISK2, DISK3, etc.  Append them into one master file by typing:
  96.           COPY B:*. DIRECTRY
  97. This will merge all of the individual directory files into one master
  98. file called DIRECTRY.
  99.      All you have to do now is go into that master DIRECTRY file with
  100. WordStar, number the individual directories sequentially, and clean
  101. them up if you don't want to see the "bytes free" messages or the
  102. "Volume in drive A has no label" messages.
  103.      To find what disk a file is on, use WordStar's string search 
  104. command (^QF) to hunt for the filename.  Scroll up through the 
  105. individual listing, once WordStar has found a match, to see what the
  106. number of the disk is.  You can find all sorts of uses for this.  For
  107. instance, you could see if copies of a file are on more than one disk,
  108. or look at every file that you created or modified last Tuesday, etc.
  109.      When you change the contents of any of the files on one of the
  110. disks listed in your master directory, you have to redirect the changed
  111. disk's directory into a temporary file, then get into the master
  112. directory and delete the old listing and read in the temporary file.
  113. You can do this is WordStar with block moves -- ^KB^KK^KY to remove the
  114. old directory, then ^KR to read in the new one.
  115.      You might also be able to use DOS FIND and SORT filter commands
  116. for this, but if you do so, you'll have to use your word processor to
  117. add the number of the disk to each line in each of your directory
  118. listings.
  119.  
  120. -----------------------------------------------------------------
  121.             Using DOS 2.0 To Organize Your Diskettes
  122.               (PC Age May 1983 by Willard A. Brown)
  123.  
  124.      Keeping track of the contents of dozens of diskettes when their
  125. contents are frequently altered can be a problem.  Here is a process
  126. for making order out of chaos by creating a catalog of the contents of
  127. a group of disks:
  128.      1. Format a disk give a volume name indicating its use: a catalog
  129. of disks and their contents.
  130.      2. Place the disk that is to be cataloged in drive A.
  131.      3. Type the following:   DIR|SORT>B:DISK1.DRA   (If the disk 
  132. being cataloged has been assigned a name, use that name instead of
  133. DISK 1.)
  134.      4. Place the next disk in drive A.
  135.      5. Type the same as above, but change the filename.
  136.      6. Continue until 10 disks have been cataloged, then start using
  137. an extension of DRB instead of DRA and repeat for the next 10 disks.
  138. The reason for this has to do with the PRINT command (see below).
  139.      7. Copy to your catalog disk in drive B the following files from
  140. your DOS disk:  CHKDSK.COM, FIND.EXE, MORE.COM, PRINT.COM, SORT.EXE,
  141. and TREE.COM.
  142.      Next you will want to make several batch files for future 
  143. convenience in searching through your catalog and making printed 
  144. copies.  The code listing below shows a sample.
  145.      After completion of this task, if you type DISPLAY, you will find
  146. on your screen a sorted page full of the names of the files that have
  147. been created.  Pressing the space bar will cause display of the next
  148. full page.  Of if you type SEARCH followed by a string of characters
  149. you will have a display of those disk names that have filenames that
  150. include the specified string of characters.
  151.      The PRINT command can store pointers for no more than 10 files.
  152. For this reason you store groups of 10 with extensions of DRA, DRB,
  153. DRC, etc. in the procedures above.  Using this strategy you can request
  154. printing of the entire stream of directories in a reasonably efficient
  155. way.  Thirty disks would only require three command lines.  The reason
  156. that a batch file is suggested for the first group is that it serves as
  157. a reminder of the form that the command line should take.
  158. - - - - -
  159. B>COPY CON:DISPLAY.BAT
  160. DIR|SORT|MORE
  161.  
  162. B>COPY CON:SEARCH.BAT
  163. FIND "%1" DISK1.DRA DISK2.DRA DISK3.DRA
  164. FIND "%1" DISK6.DRA DISK7.DRA
  165. FIND "%1" DISK11.DRB DISK12.DRB
  166.  
  167. B>COPY CON:PRINTA.BAT
  168. PRINT *.DRA
  169.  
  170. -----------------------------------------------------------------
  171.                             Bug Hung
  172.        (PC Magazine Vol 4 No 2 Jan 22, 1985 User-to-User)
  173.  
  174.      1. If your default drive is A: and you are trying to rename a file
  175. in drive B: with the BASIC NAME command, you get a "Rename across
  176. disks" error message.  The solution is to not use the format given in
  177. the BASIC manual.  Instead use "NAME filespec AS filespec."
  178.      2.  Advanced programmers using IBM's ASM/MASM Assembler may be
  179. puzzled by a mysterious "?End of file encountered on input file" error
  180. message that appears on start-up.  It's not in IBM's manuals.  All it
  181. means is that you probably answered the start-up prompts with a
  182. complete filespec instead of just a filename.  All the assembler wants
  183. is "[d:]filename". You probably entered "[d:] filename.ext".
  184.      3. If CHKDSK reports one more hidden file than you think you
  185. should have, you probably just formatted the disk with the /V switch.
  186. CHKDSK reports the VOLUME ID label as a hidden file.
  187.      4.  Do your batch files end with a double prompt A> A>?  You can
  188. avoid this by typing the EOF marker (Ctrl-Z or function key F6) on the
  189. same line as the last command instead of on the next line.  A blank
  190. space typed before the marker is optional.
  191.      5.  Are you annoyed by the REMs that clutter up your display when
  192. you want to make a REMark in a batch file with ECHO ON?  Try using a
  193. period (.) instead.  It means the same as REM, but it yields a much
  194. neater display.  There is also another use for the period with ECHO
  195. OFF.  To skip lines between commands, use an ECHO . command wherever
  196. you want a blank line.  The line displayed will be blank except for a
  197. single period in the first position.
  198.      6.  If you're using your word processor to write batch files, the
  199. EOF marker is usually not available from the F6 key.  Use a Ctrl-Z key
  200. combination instead.  Your screen will show a "right arrow", the ASCII
  201. symbol for Ctrl-Z. 
  202.      7.  When using a RAMdisk, you must have a complete operating 
  203. system in place if you want to invoke DOS commands from the RAMdisk.
  204. Use SYS d: and COPY COMMAND.COM d: to load IBMBIO.COM, IBMBIO.COM, and
  205. COMMAND.COM into the first three files on your RAMdisk.  Make sure that
  206. they are the first three files and that IBMBIO.COM resides in
  207. contiguous sectors.  The easiest way to do this is to start with a
  208. completely empty RAMdisk.
  209.      Editor's Notes: 
  210.      (1) When renaming files on one disk from another, be sure and play
  211. it safe by putting the drive at the beginning of each, for example,
  212. name B:TEST.BAS as B:RETEST.BAS.  While it's true that the BASIC manual
  213. is confusing, it makes one good point -- filenames don't default to a
  214. BAS extension; you have to add it if you want it.
  215.      (6) It's generally safe to end a line with Ctrl-Z (F6 in DOS), but
  216. there are times when a line has to end in a carriage return.  For
  217. instance, if you're typing ANSI magic, you have to hit the carriage
  218. return before the Ctrl-Z.  But normal batch files don't usually need
  219. the extra carriage return.
  220.      (7) DOS 3.0 doesn't let you use a period (.) instead of a REM.
  221. If you want to save trouble, you can use the COMMAND C:\ to move
  222. COMMAND.COM, but it's not necessary to schlep the hidden files on
  223. RAMdisk.
  224.  
  225. -----------------------------------------------------------------
  226.                            Tidy Lister
  227.        (PC Magazine Vol 4 No 2 Jan 22, 1985 User-to-User)
  228.  
  229.      If you are putting up with "untidy" listings of long BASIC 
  230. programs, help files and the like, you can modify the DOS 2.x MORE
  231. filter to pause after a full page rather than a 24-line screenful.
  232. Alter MORE to pause every 55 lines by:
  233.      1. Make a copy of MORE.COM under another name -- PORE.COM.
  234.      2. With DEBUG.COM and PORE.COM in the default drive, enter:
  235.           A>DEBUG PORE.COM
  236.           - D
  237.           - E0118
  238.           - xxxx:0118    19.37
  239.           - W
  240.           - Q
  241.      (Note:  Check for the value "19" which should appear at offset
  242. :0118, the byte at the right of the long line, and ignore the numbers
  243. that replace xxxx.)
  244.      Now when you need a listing of a BASIC program (saved in ASCII)
  245. or any ASCII file from DOS, enter:
  246.           TYPE FILENAME|PORE>LPT1:
  247. Use the correct device name (if different) in place of LPT1:.  After
  248. listing 54 lines of the file, the printer pauses.  With a quick
  249. Off-Line/Form-Feed/On-Line sequence a a press of any key, the next page
  250. is off and running.
  251.      Editor's Note:  You can also create a batch file, called PMOR.BAT,
  252. that automatically does this job:
  253.           A>COPY CON:PMOR.BAT
  254.           TYPE %1|PORE>LPT1:
  255. Then, to type a file with the new PORE pauses in it while in DOS, just
  256. enter PMOR <filename>.  Also, to avoid having the phrase "--more--"
  257. appear on your printouts, while you're in DEBUG, add the following line
  258. just before you write (by hitting W):
  259.           -F 1F1 1FA 20
  260. This replaces the "--more--" message with blank spaces.
  261.  
  262. -----------------------------------------------------------------
  263.                          Poor Man's MODE
  264.       (PC Magazine Vol 4 No 15 July 23, 1985 User-to-User)
  265.  
  266.      While the DOS MODE command performs a variety of I/O functions,
  267. many readers probably use it only to select video modes.  It's possible
  268. to bypass MODE.COM and do this directly by using the SCREEN.COM program
  269. below, which speeds things up and saves 5K of space on disk.  Once
  270. you've entered the program using DEBUG, use the command SCREEN n,
  271. substituting a number from 0 to 3 in space of n.  Here are the new
  272. SCREEN n values along with their old MODE n equivalents:
  273.           New SCREEN n        Old MODE.COM n
  274.                0               BW40 (or 40)
  275.                1               CO40
  276.                2               BW80 (or 80)
  277.                3               CO80
  278.      Editor's Note:  This does the job, but MODE.COM cones in handy
  279. elsewhere and at 5K isn't a space hog, especially on a hard disk.  But
  280. if you're tight for space on a floppy, or if you want to give away or
  281. sell a disk and don't want to put IBM's copyrighted MODE.COM on it,
  282. this is for you.
  283. - - - - -
  284. A>debug
  285. -n screen.com
  286. -a
  287. xxxx:0100   xor ax,ax
  288. xxxx:0102   mov bx,0081
  289. xxxx:0105   cmp byte ptr [bx],20
  290. xxxx:0108   jnz 010d
  291. xxxx:010A   inc bx
  292. xxxx:010B   jmp 0105
  293. xxxx:010D   mov al,[bx]
  294. xxxx:010F   cmp al,33
  295. xxxx:0111   ja 0117
  296. xxxx:0113   cmp al,2f
  297. xxxx:0115   ja 0119
  298. xxxx:0117   mov al,33
  299. xxxx:0119   sub al,30
  300. xxxx:011B   int 10
  301. xxxx:011D   int 20
  302. xxxx:011F
  303. -rcx
  304. CX 0000
  305. :lf
  306. -w
  307. Writing 001F bytes
  308. -q
  309.  
  310. -----------------------------------------------------------------
  311.                          Screen Blanker
  312.       (PC Magazine Vol 4 No 15 July 23, 1985 User-to-User)
  313.  
  314.      For users who leave their monitors on all night to use the CTTY
  315. remote control, the program below will blank their screens as
  316. recommended in "Remote Access with CTTY" (Vol 4 No 3).  Enter the
  317. program with DEBUG.  To run the program, simply type BLANK at the DOS
  318. prompt.  To return from the blank screen, use the DOS MODE command or
  319. change the byte at &h108 from 00 to 07.
  320. - - - - -
  321. A>debug
  322. -a 100
  323. xxxx:0100   mov dx,1950
  324. xxxx:0103   mov cx,0000
  325. xxxx:0106   mov ax,0600
  326. xxxx:0109   mov bh,00
  327. xxxx:010B   int 10
  328. xxxx:010D   mov al,00
  329. xxxx:010F   mov dx,03d9
  330. xxxx:0112   out dx,al
  331. xxxx:0113   int 20
  332. xxxx:0115
  333. -rcx
  334. cx 0000
  335. :114
  336. -n BLANK.COM
  337. -w
  338. Writing 0114 bytes
  339. -q
  340.  
  341. NOTE:  To create UNBLANK.COM, substitute MOV BH,07 for the line
  342. MOV BH,00 and enter MOV AL,# instead of MOV AL,00 -- substituting the
  343. hex number of your border clor (3=cyan, 2=green, etc.) for the #.
  344. Also, name it UNBLANK.COM.
  345.  
  346. -----------------------------------------------------------------
  347.                        Beyond DOS COMPare
  348.        (PC Magazine Vol 4 No 16 Aug 6, 1985 User-to-User)
  349.  
  350.      The DOS compare files command (COMP) compares two files until it
  351. finds 10 differences, then stops.  You may want to compare two files
  352. even though the number of differences exceeds this limit.  For DOS 2.x,
  353. use DEBUG to change the limit to any number of comparisons you'd like:
  354.  
  355. A>DEBUG COMP.COM
  356. -e 39a nn
  357. -e 809 "xx"
  358. -w
  359. Writing 09E6 bytes
  360. -q
  361.  
  362. To change the number to 14, for example, replace the nn with 0E (the
  363. hex notation for 14) and the "xx" to "14".  For DOS 3.x, substitute
  364. 879 for 39a and b51 for 809.
  365.      This patch will let you change COMP to continue file comparisons
  366. without any limit on the number of byte-by-byte differences COMP finds
  367. for DOS 2.x:
  368.  
  369. A>DEBUG COMP.COM
  370. -e 39b 90 90
  371. -w
  372. Writing 09E6 bytes
  373. -q
  374.  
  375. For DOS 3.x, use 87a for 39b.
  376.      Editor's Note:  This DOS 2.x trick works, but it doesn't handle
  377. the annoying problem where, if there is just one extra byte at the
  378. beginning of one file being compared, COMP gets confused and the whole
  379. process becomes meaningless.
  380.  
  381. -----------------------------------------------------------------
  382.                          Cursor Toggling
  383.      (PC Magazine Vol 4 No 22 October 29, 1985 User-to-User)
  384.  
  385.      CURSON.COM, written for a color display, turns the cursor back on
  386. if it disappears when exiting from a program.  To adapt it to work on
  387. a monochrome display, change the 0607 in the first MOV instruction to
  388. 0C0D.  Also, if you want to turn the cursor off, change the same
  389. instruction to 0F00.
  390.  
  391. A>DEBUG CURSON.COM
  392. File not found
  393. -A
  394. xxxx:0100  MOV  CX,0607
  395. xxxx:0103  MOV  AH,01
  396. xxxx:0105  INT  10
  397. xxxx:0107  INT  20
  398. xxxx:0109
  399. -RCX
  400. CX 0000
  401. :9
  402. -W
  403. Writing 0009 bytes
  404. -Q
  405.  
  406. -----------------------------------------------------------------
  407.                      Cursoring a Blue Streak
  408.          (PC Magazine Vol 4 No 25 Dec 10, 1985 PC Tutor)
  409.  
  410.      The size of the cursor on the PC can be controlled by ports on
  411. the 6845 video controller chip.  It's easier to use the BIOS Interrupt
  412. 10h function call 01h, however.  Use DEBUG to create the CURSOR.COM
  413. program below that will let you experiment with different cursor sizes.
  414. The program takes two arguments (each a 2-digit hex number) to specify
  415. the top scan line and the bottom scan line of the cursor.  You can
  416. start by entering the following commands, depending on whether you have
  417. a monochrome or color/graphics display:
  418.           Monochrome Normal:   CURSOR 0B 0C
  419.           Monochrome Box   :   CURSOR 00 0C
  420.           Color Normal     :   CURSOR 06 07
  421.           Color Box        :   CURSOR 00 07
  422.      Using CURSOR.COM to experiment with cursor size is better than
  423. using the BASIC LOCATE statement because you can go beyond 1F hex (or
  424. 31 decimal) in the arguments.  You may notice through experimentation
  425. that the blink is slowed down somewhat by values of 6x (for instance,
  426. CURSOR 66 67), but it cannot be turned off entirely.
  427.      Whether other programs will destroy your settings depends on the
  428. program.  Some do; some don't.
  429.      For programs that use a nonblinking cursor, you're seeing a
  430. hardware-generated cursor.  Programs can hide the read hardware cursor
  431. and then create their own "cursor" by writing the characters to the
  432. display with a reverse-video attribute.  Mimicking this process in a
  433. memory-resident utility is not entirely successful.  BIOS Interrupt 10h
  434. calls can be intercepted to substitute a reverse-video screen attribute
  435. for the blinking cursor, but this only worked at the DOS-command level.
  436. It was an absolute mess with some other programs.  For instance,
  437. WordStar 3.30 uses the BIOS services to set the cursor position, but
  438. it uses direct memory to write to the screen and scroll it.  This
  439. results in multiple copies of a "cursor" appearing all over the screen.
  440.  
  441. A>DEBUG
  442. -A
  443. xxxx:0100  MOV  AX,[005D]
  444. xxxx:0103  CALL 0116
  445. xxxx:0106  MOV  CH,AL
  446. xxxx:0108  MOV  AX,[006D]
  447. xxxx:010B  CALL 0116
  448. xxxx:010E  MOV  CL,AL
  449. xxxx:0110  MOV  AH,01
  450. xxxx:0112  INT  10
  451. xxxx:0114  INT  20
  452. xxxx:0116  CALL 0125
  453. xxxx:0119  XCHG AL,AH
  454. xxxx:011B  CALL 0125
  455. xxxx:011E  MOV  CL,04
  456. xxxx:0120  SHL  AH,CL
  457. xxxx:0122  ADD  AL,AH
  458. xxxx:0124  RET
  459. xxxx:0125  OR   AL,20
  460. xxxx:0127  SUB  AL,57
  461. xxxx:0129  JNB  012D
  462. xxxx:012B  ADD  AL,27
  463. xxxx:012D  RET
  464. xxxx:012E
  465. -N CURSOR.COM
  466. -R CX
  467. CX 0000
  468. :002E
  469. -W
  470. Writing 002E bytes
  471. -Q
  472.  
  473. -----------------------------------------------------------------
  474.                  Behind the Eight Ball with DEL
  475.      (PC Magazine Vol 4 No 22 October 29, 1985 User-to-User)
  476.  
  477.      Here's an easy, new and undocumented feat of prestidigitation.
  478. A mere slip of the finger, and much of your current subdirectory or
  479. floppy disappears like magic!
  480.      Say you've got a bunch of files whose names don't have extensions,
  481. like MOE, LARRY and JOE.  You've also got some with the .BAT extension:
  482. MOE.BAK, LARRY.BAK and CURLY.BAK.  May as well get rid of those useless
  483. backups.  Nothing to it.  You simply type:  erase *.bak (or del *.bak).
  484.      Except that after you hit the asterisk over the 8, you accidentally
  485. let go of the Shift an instant too late.  What you type instead, since
  486. the > sign is over the period, is:  erase *>bak (or del *>bak).
  487.      You hit the Enter key before you catch the error.  And when you
  488. look at the directory, you discover the .BAK files are still there.
  489. Missing are all of your files whose names lack extensions.  MOE, LARRY
  490. and CURLY are gone, and so are PETER, PAUL and MARY.  You may not see
  491. it in the directory, but you now have a file called BAK whose length
  492. is zero.
  493.      Agony!  An immediate trip to the undelete utility.  It's likely
  494. to be a long session.  Seeing the > sign, DOS thought you were trying
  495. to redirect the output of the ERASE command into a file called BAK;
  496. the output of the ERASE command is nothing at all.  Of course, the
  497. lone asterisk meant you wanted to erase all files whose names lack
  498. extensions.  DOS was kind enough to oblige.
  499.      Moral: when using the ERASE or DEL command, avoid the Shift keys.
  500. Use the asterisk under PrtSc instead of the one over the 8.  Or
  501. automate things; create a batch file with the single line: del *.bak,
  502. and call it DELBAK.BAT.  Then you type in DELBAK and you'll never find
  503. yourself behind the eight ball.
  504.      Editor's Note:  Using the PrtSc asterisk introduces another
  505. headache.  If you happen to be leaning on a Shift when you hit this
  506. key, you either get a printed page full of junk if your printer is
  507. on-line, or a long hang if it's not.  The batch file is the best
  508. solution, and add three lines at the beginning:
  509.           echo off
  510.           echo Ready to del .BAK files
  511.           pause
  512. This reminds you of what you're doing and gives you one more chance to
  513. Ctrl-Break out before a valuable backup file vanishes.
  514.  
  515. -----------------------------------------------------------------
  516.                               Global FIND
  517.          (PC Magazine Vol 4 No 6 March 19, 1985 User-to-User)
  518.  
  519.      The only problem with the DOS 2.x command FIND is that you cannot 
  520. use global filename characters in specifying the names of the files you 
  521. want searched.  Sometimes you want to search all the files on a disk
  522. for a particular string, and entering all the filenames is a bother.
  523.      One way to avoid entering all the filenames is to use the FOR 
  524. command.  If FIND.EXE is in drive A:, and the disk you want to search
  525. is in B:, the following command, which must be executed as part of a
  526. batch file, will search all the files on B: for the string "your
  527. generous offer":
  528.           FOR %%F IN (B:*.*) DO FIND "your generous offer" IN %%F
  529.      This command executes quickly, but it can go much faster if the 
  530. files being searched are on a RAMdisk.  Also, since FIND is an external 
  531. command, it is loaded every time the command is executed so FIND should 
  532. be on a RAMdisk.
  533.      There is one problem to be solved.  When FIND examines itself it 
  534. sends the PC into never-never land and has to be rebooted.  So FIND 
  535. should be in a different subdirectory.  As a remedy, create a 
  536. subdirectory named \FINDSD and copy FIND.EXE into it.  Then make the 
  537. root directory the default directory, copy this batch file into it, and 
  538. execute the batch file:
  539.           ECHO OFF
  540.           PATH \FINDSD
  541.           FOR %%F IN (*.*) DO FIND "your generous offer" IN %%F
  542.  
  543. -----------------------------------------------------------------
  544.                              FIND Unquoter
  545.           (PC Magazine Vol 4 No 13 June 25,1985 User-to-User)
  546.  
  547.      As a frequent user of the DOS FIND filter, I grew tired of having 
  548. to enclose each string I was searching for inside quotation marks.  I 
  549. figured out how to fix FIND.EXE so that quotes are not necessary (see 
  550. below).  The drawback is that his new version of FIND can't search for 
  551. strings containing spaces.  I named this utility after the UNIX
  552. command FGREP.
  553. - - - - -
  554. Instructions for changing DOS 3.0 FIND.EXE:
  555. A>copy find.exe fgrep
  556.      1 File(s) copied
  557. A>debug fgrep
  558. -e 3cc
  559. xxxx:03CC  75.4e  0A.90
  560. -e 3e9
  561. xxxx:03E9  22.20
  562. -e 3ec
  563. xxxx:03EC  AC.90  3C.90  22.90  74.90
  564. xxxx:03F0  0F.90  4E.90
  565. -w
  566. Writing 18DB bytes
  567. -q
  568. A>rename fgrep fgrep.exe
  569.  
  570. -----------------------------------------------------------------
  571.                            Random File SORTs
  572.           (PC Magazine Vol 4 No 10 May 14, 1985 User-to-User)
  573.  
  574.      The SORT filer command in DOS 2.1 does not work satisfactorily. 
  575. The program is supposed to read data from the standard input device, 
  576. sort it and write the data to the standard output device.  It can sort 
  577. data in alphabetical order or in reverse alphabetical order and can 
  578. begin the sort on a specified column.  The problem is that a programmer 
  579. can specify whatever record length he wants when he loads BASIC. 
  580. Unfortunately, the SORT filter does not know the length of the records 
  581. in a random file since the operation is conducted in DOS, not BASIC. 
  582. There is a way around this problem.
  583.      To tell the SORT filter where each record ends, you must add a 
  584. carriage return and then a line feed at the end of each record.  This
  585. is easily handled by following these steps:
  586.      1. OPEN the file as usual.
  587.      2. FIELD the file, adding as the last two variables:
  588.         1 AS CR$, 1 AS FL$
  589.      3. LSET as usual with the following two last statements
  590.         LSET CR$=CHR$(13):LSET LF$=CHR$(10)
  591.      Now when the SORT filter begins, it will automatically know where 
  592. each record ends, and the command will work properly.  Additionally, if 
  593. you want to examine the actual file using the DOS TYPE command, you 
  594. will notice that each record will begin at the left edge of the screen, 
  595. which makes examining the file much easier.  Finally, be sure to allow 
  596. for the extra bytes when OPENing the file.
  597.      Editor's Note:  SORT needs carriage returns at the end of each 
  598. record to work properly, and this inserts them properly.  But sorting 
  599. random length files can pose problems, for instance, when you're 
  600. sorting on a specified column that isn't there.  In any event, it
  601. would be simple to write a short BASIC program that reads an existing
  602. random file, adds carriage returns, and writes the data to a new file
  603. with slightly longer FIELDs so the records could be sorted properly.
  604.  
  605. -----------------------------------------------------------------
  606.                         Five Easy Patches
  607.        (PC Magazine Vol 4 No 24 Nov 26, 1985 User-to-User)
  608.  
  609.      Even DOS 3.1 COMMAND.COM has deficiencies.  The first deficiency
  610. is that whoever wrote COMMAND.COM didn't know how many lines are on a
  611. standard video display, since the CLS command will clear 26 lines
  612. rather than the standard 25.  While this may not appear to be a
  613. problem, if you run a program that uses the PC's extra video pages,
  614. you may find the first line of an extra page mysteriously erased.  The
  615. reason for the error is probably that the video-scroll function in BIOS
  616. is based on zero-relative values, so the existing COMMAND.COM value of
  617. 25 actually clears lines 1 through 25, plus line 0.
  618.      To fix this bug, make sure DEBUG and DOS 3.1 COMMAND.COM are on
  619. your disk and type:
  620.  
  621. DEBUG COMMAND.COM
  622. E 263B 18
  623. W
  624. Q
  625.      The second problem lies in the DOS 3.1 ECHO command.  While
  626. undocumented, it is an accepted fact that in a batch file an ECHO
  627. command followed immediately by two spaces will generate a blank line.
  628. This works on earlier versions of DOS, but not 3.1.  Instead of
  629. displaying a blank line, DOS will return the current status of ECHO.
  630. Since most batch files start by turning ECHO off, instead of inserting
  631. clean blank lines, this problem clutters your screen with a lot of
  632. "ECHO is off" messages.  To fix COMMAND.COM so ECHO and two spaces
  633. will produce a blank line, make sure DEBUG and DOS 3.1 COMMAND.COM
  634. are on your disk and type:
  635.  
  636. DEBUG COMMAND.COM
  637. E 3878 83
  638. E 3879 F9
  639. E 387A 02
  640. E 387B 72
  641. W
  642. Q
  643.      Problem three is that COMMAND.COM normally defaults to ECHO ON,
  644. forcing most users to turn it off in the first line of all their batch
  645. files.  Apart from being a nuisance, this puts an ECHO OFF line on the
  646. screen.  COMMAND.COM handles this default separately for AUTOEXEC.BAT
  647. and for all other batch files.  To turn the default to OFF in both
  648. cases, make sure DEBUG and DOS 3.1 COMMAND.COM are on your disk and
  649. type:
  650.  
  651. DEBUG COMMAND.COM
  652. E 105B 2
  653. E 1967 0
  654. W
  655. Q
  656.      The fourth and fifth problems are that DOS won't simply print
  657. the date and time if you request it; instead it will first stop and ask
  658. you for the new date and time.  You can of course just hit the Enter
  659. key to procede, but this makes it harder to date- and time-stamp your
  660. files.  The way to get aroudn this is to create two new commands,
  661. DATER and TIMER, that bypass the request for new information and send
  662. control directly to the routines that print the date and time.
  663.      COMMAND.COM contains a table of familiar words such as DIR,
  664. RENAME (and REN), ERASE (and DEL), etc., that it examines every time
  665. you enter a command.  Fortunately for anyone wishing to play with the
  666. command table, three words on the list -- CHDIR, MKDIR and RMDIR --
  667. are redundant, since every user in the world uses the shorter CD, MD
  668. and RD versions.  This lets us use the space on the table for TIMER
  669. and DATER.  The reason these new commands are five letters long is,
  670. of course, that they will replace existing five-letter commands.
  671.      The DOS 3.1 COMMAND.COM command table begins at around 4CF4.
  672. Each entry on the table is made of four parts.  The first is a byte
  673. that specifies how many characters are in the particular command.
  674. This is followed by the command itself.  After the text of the command
  675. is a byte that seems to tell DOS whether the command needs an argument,
  676. may have an argument, or never requires an argument.  Both TIMER and
  677. DATER don't need an argument, so this byte will be 0.  The fourth part
  678. is the 2-byte address of the routine that COMMAND.COM will transfer
  679. control to.
  680.      To change CHDIR to DATER, make sure DEBUG and DOS 3.1 COMMAND.COM
  681. are on your disk and type:
  682.  
  683. DEBUG COMMAND.COM
  684. E 4D7D "DATER"
  685. E 4D82 0
  686. E 4D83 2E
  687. E 4D84 26
  688. W
  689. Q
  690.      To change MKDIR to TIMER, type:
  691.  
  692. DEBUG COMMAND.COM
  693. E 4D8C "TIMER"
  694. E 4D91 0
  695. E 4D92 DF
  696. E 4D93 1E
  697. W
  698. Q
  699.      While these patches are for DOS 3.1 only, some of them can be
  700. adapted to earlier versions of COMMAND.COM.
  701.      Editor's Note:  While some might argue that it's bad to use an
  702. undocumented feature like the ECHO+space+space above, once users learn
  703. about it they will incorporate it into their programs as if it were in
  704. the manual.  Once you've made all the changes, you either have to
  705. reboot your system to install the patched COMMAND.COM, or invoke it as
  706. a secondary command processor by typing COMMAND.  A nifty way to reboot
  707. automatically by using DEBUG is to create a file called RB that
  708. contains the five lines:
  709.  
  710. rcs
  711. ffff
  712. rip
  713. 0000
  714. g
  715.  
  716. Make sure you include a carriage return at the end of each line.  Then
  717. create a batch file called REBOOT.BAT that contains the one line:
  718.  
  719. DEBUG < RB
  720.  
  721. Be certain that DEBUG.COM is on your current directory, or that you
  722. PATH to it.
  723.